package com.grad.why.studentsystem.service.qlxservice.qlximpl;

import com.grad.why.studentsystem.domain.Student;
import com.grad.why.studentsystem.domain.User;
import com.grad.why.studentsystem.domain.current.CurrentChooseCourseInfo;
import com.grad.why.studentsystem.mapper.StudentMapper;
import com.grad.why.studentsystem.mapper.qlxmapper.StudentInfoMapper;
import com.grad.why.studentsystem.service.qlxservice.StudentInfoService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;

/**
 * @author tyh
 * @Package com.grad.why.studentsystem.service.qlxservice.qlximpl
 * @Description:
 * @date 19-5-16 下午1:48
 */
@Service
public class StudentInfoServiceImpl implements StudentInfoService {

    @Autowired
    StudentMapper studentMapper;

    @Autowired
    StudentInfoMapper studentInfoMapper;

    @Override
    public Student getStudentInfo(int bindId) {
        return studentMapper.selectByPrimaryKey(bindId);
    }

    @Override
    public List<Map<String,Object>> getChooseCourseInfo(int offset, int limit, String search,int bindId) {
        try{
            return studentInfoMapper.getChooseCourseInfo(offset,limit,search,bindId);
        }catch (Exception e){
            e.printStackTrace();
        }
        return null;
    }

    @Override
    public long getChooseCourseInfoLength(String search,int bindId) {
        try{
            return studentInfoMapper.getChooseCourseInfoLength(search,bindId);
        }catch (Exception e){
            e.printStackTrace();
        }
        return 0;
    }
}
